<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../代码/01-react基础/lib/react.development.js"></script>
    <script src="../代码/01-react基础/lib/react-dom.development.js"></script>
    <script src="../代码/01-react基础/lib/babel.min.js"></script>
    <title>Document</title>
</head>

<body>
    <div id="root"></div>
</body>
<script type="text/babel">
    const root = ReactDOM.createRoot(document.getElementById('root'))

    const list = [
        { id: 1, name: 'jack', content: '好的没有问题', time: '2024/10/15' },
        { id: 2, name: 'jack', content: '好的没有问题', time: '2024/10/15' },
        { id: 3, name: 'jack', content: '好的没有问题', time: '2024/10/15' },
        { id: 4, name: 'jack', content: '好的没有问题', time: '2024/10/15' },
        { id: 5, name: 'jack', content: '好的没有问题', time: '2024/10/15' },
    ]

    root.render((
        <div>
            <div>评论列表</div>
            <ul>
                {list.map((item) => {
                    return (
                        <li key={item.id}>
                            <a>
                                <h3>{item.name}</h3>
                                <p onClick={() => alert(item.time)}>{item.content}</p>
                            </a>
                        </li>
                    )
                })}
            </ul>
        </div >
    ))
</script>

</html>